<template>
  <el-form ref="user" :model="user" label-width="80px">
  <el-form-item label="用户名">
    <el-input v-model="user.userName"></el-input>
  </el-form-item>
  <el-form-item label="密码">
    <el-input v-model="user.userPwd"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="onSubmit">确定</el-button>
    <el-button>取消</el-button>
  </el-form-item> 
  </el-form>
</template>

<script>
import {login} from "@/services/Login.js"
export default {

    data(){
        return {
            user:{
                userName:"",
                userPwd:""
            }
        }
    },
    methods:{
       async onSubmit(){
         var resp =  await login(this.user);
         console.log("=======执行login方法得到返回回来的user=======");
         console.log(resp);
         if(resp){
             this.$router.push({name:"MainMenu",params:{
               uu:resp.userId
             }});
         }
       }
    }

}
</script>

<style>

</style>